﻿using System.ServiceProcess;

namespace common.system
{
    public class windowservice
    {
        public static void startservice(string name)
        {
            ServiceController sc = new ServiceController(name);

            //Console.WriteLine("The Telnet service status is currently set to {0} ", sc.Status.ToString());

            if ((sc.Status.Equals(ServiceControllerStatus.Stopped)) || (sc.Status.Equals(ServiceControllerStatus.StopPending)))
            {                // Start the service if the current status is stopped.
                //MessageBox.Show("Starting the Telnet service... ");
                sc.Start();
            }
        }
    }
}